﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using log4net;
using Mate.Caching;
using Mate.Comment.Service;
using Mate.Framework.BaseController.Admin;
using Microsoft.AspNetCore.Mvc;

namespace Mate.Admin.Controllers.Comment
{
    public class ReplyController : BaseController
    {
        private readonly IReplyService replyService;
        private readonly ILog log;
        private readonly ICacheManager _cache;
        public ReplyController(IReplyService replyService, ICacheManager cache, ILog log)
        {
            this.log = log;
            this.replyService = replyService;
            this._cache = cache;
        }


        public IActionResult Index(int commentid)
        {
            ViewBag.CommentId = commentid;
            return View();
        }

        #region 获取列表
        [HttpPost]
        public IActionResult GetList(int commentid,int pageIndex, int pageSize, string Key)
        {
            int recordCount = 0;
            var list = replyService.GetReplyList(commentid,pageIndex, pageSize, Key, ref recordCount);
            var result = new
            {
                rows = list,
                total = recordCount
            };
            return Json(result);
        }
        #endregion
    }
}